package com.base.factory.abstructfactory.factory;


import com.base.factory.abstructfactory.factory.impl.AsusFactory;
import com.base.factory.abstructfactory.factory.impl.DellFactory;
import com.base.factory.abstructfactory.factory.impl.ThinkPadFactory;
import com.base.factory.abstructfactory.service.ComputerService;
import com.base.factory.abstructfactory.service.impl.Dell;
import com.base.factory.abstructfactory.service.impl.ThinkPad;

/**
 * Created by xingyuchao on 2017-06-17.
 * 同样定义工厂标准
 */
public abstract class ComputerFactory {

    public abstract ComputerService getComputer();

    public ComputerService getComputer(String computerName){
        if("Asus".equals(computerName)){
            return new AsusFactory().getComputer();
        }else if("Dell".equals(computerName)){
            return new DellFactory().getComputer();
        }else if("ThinkPad".equals(computerName)){
            return new ThinkPadFactory().getComputer();
        }else{
            return null;
        }
    }
}
